feat(pi-mono): add @keycardai/pi-mono package#9
Open
Larry-Osakwe wants to merge 4 commits into
Open
Conversation
…ration Adds a new package that enables pi-mono coding agents to use Keycard-protected MCP servers. Converts MCP tools to pi-mono's AgentTool format, handles OAuth auth detection, and generates auth-aware system prompts. - PiMonoClient: main adapter (detect auth, get tools, system prompt) - Tool conversion: MCP Tool → AgentTool via Type.Unsafe() for schema bridging - Auth tools: pluggable AuthToolHandler with Default/Console implementations - Prompt builder: auth-aware system prompt section generator - Unit tests: 44 tests covering tools, auth, prompt, client - E2E test: local MCP server + InMemoryTransport + pi-mono agent session - SDK re-export via @keycardai/sdk/pi-mono subpath - README: "Which Package?" table for user guidance Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove getErrorServers() — "error" status was never set by detectAuthStatus() - Remove "error" from ServerAuthStatus union — no code path produces it - Remove unused AgentToolUpdateCallback re-export from types.ts Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Runnable pi-mono agent with Keycard MCP tools — connects to Keycard-protected servers, converts tools, streams responses. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@keycardai/pi-mono— a new package that enables pi-mono coding agents to use Keycard-protected MCP serversAgentToolformat with OAuth auth detection and auth-aware system promptsWhat's included
packages/pi-mono/src/client.tsPiMonoClient— main adapter (detect auth status, convert tools, generate prompts)packages/pi-mono/src/tools.tsType.Unsafe()for JSON Schema → TypeBox bridgingpackages/pi-mono/src/auth-tools.tsAuthToolHandlerinterface + Default/Console implementationspackages/pi-mono/src/prompt.tspackages/pi-mono/src/types.tspackages/sdk/src/pi-mono.ts@keycardai/sdk/pi-monosubpathHow it works
Pi-mono agents pass tools as
AgentTool[]tocreateAgentSession(). This package:AgentToolinstancesrequest_authorizationtool for unauthorized serversAll pi-mono framework features (extensions, skills, AGENTS.md discovery, session management, compaction, thinking levels) work unchanged — our tools are just additional entries in the agent's toolkit.
README updates
Added a "Which Package?" table to the root README guiding users to the right package for their use case.
Test plan
pnpm -r run typecheck)pnpm -r run build)createAgentSession()with Anthropic API key → LLM successfully called MCP tool through AgentTool wrapper🤖 Generated with Claude Code